<?php
$this->breadcrumbs = array(
    'Advertising' => array('index'),
    'Manage',
);
?>
<div class="box">
    <header>
        <h5>Manage Advertising</h5>
    </header>
    <div class="body">
	<?php
	$this->widget('bootstrap.widgets.TbGridView', array(
	    'id' => 'advertising-grid',
	    'dataProvider' => $model->search(),
	    'filter' => $model,
	    'columns' => array(
		array(
		    'name' => 'userName',
		    'header' => 'Username',
		    'type' => 'raw',
		    'value' => function ($data) {
			return "<a href='" . BACKEND_SITE_URL . "user/member/update?id=" . $data->user->user_id . "'>" . h($data->user->username, 10) . "</a>";
		    }
		),
		array(
		    'name' => 'type',
		    'value' => '$data->getType()',
		    'filter' => Ad::getAllType()
		),
//		array(
//		    'name' => 'main_category'
//		),
		'title',
		array(
		    'name' => 'status',
		    'value' => '$data->getStatusText()',
		    'filter' => Ad::getStatusArray()
		),
		array(
		    'name' => 'updated',
		    'header' => 'Last update',
		    'filter' => false,
		    'type' => 'datetime'
		),
		array(
		    'class' => 'bootstrap.widgets.TbButtonColumn',
		),
	    ),
	));
	?>
    </div>
</div>